<template>
	<view>
		<u-grid :border="true" col="4" style="margin-bottom: 40rpx;">
			<u-grid-item v-for="(item, index) in tabList"
			<u-grid-item v-for="(item, index) in tabList" :customStyle="{height:140+'rpx',opacity:item.alive?'1':'0.5'}"
				:index="index" :key="index" @click="setCurrent(item)">
				<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="item.icon" :size="30"></u-icon>
				<text class="grid-text">{{ item.name }}</text>
			</u-grid-item>
		</u-grid>
		<billsByMonth ref="billsByMonth" v-if="current == '周期账单'" />
		<dateProperties ref="dateProperties" v-if="current == '资产记录'" />
		<datePropertiesChart ref="datePropertiesChart" v-if="current == '资产历史'" />
	</view>
</template>

<script>
	// import {
	// 	callCloudFunction
	// } from '@/api/requests.js'
	// import billsList from '../../components/billsList/billsList.vue'
	// import myTabbar from '../../components/myTabbar/myTabbar.vue'
	import billsByMonth from './components/billsByMonth.vue'
	import dateProperties from './components/dateProperties.vue'
	import datePropertiesChart from './components/datePropertiesChart.vue'
	export default {
		components:{
			billsByMonth,
			dateProperties,
			datePropertiesChart,
		},
		data() {
			return {
				current:'',
				tabList: [
					{
						name: '周期账单',
						icon: 'calendar',
						alive:true
					},
					{
						name: '资产记录',
						icon: 'order',
						alive:true
					},
					{
						name: '资产历史',
						icon: 'photo',
						alive:true
					},
					{
						name: '资产变化(开发中)',
						icon: 'hourglass'
					},
					{
						name: '待填充',
						icon: 'question'
					},
					{
						name: '待填充',
						icon: 'question'
					},
					{
						name: '待填充',
						icon: 'question'
					},
				]
			}
		},
		methods: {
			setCurrent(item){
				if(item.alive)this.current = item.name
			}
		},
		onLoad() {
			const that = this
			const showItem = this.tabList.find(item=>{
				return item.alive
			})
			this.current = showItem?.name
		},
		onShow() {
			this.$refs.billsByMonth?.init()
		}
	}
</script>

<style>
	.grid-text{
		font-size: 12px;
	}
</style>
